package lanqiao;


import java.util.HashSet;
import java.util.Set;

public class 不同字串 {
    public static void main(String[] args) {
        String str = "0100110001010001";
        HashSet<String> set = new HashSet<>();
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            for (int j = i+1; j <str.length() ; j++) {
                 String string = str.substring(i,j);
                 if (!set.contains(string)){
                     set.add(string);
                     System.out.println(string);
                     sum++;
                 }
            }
        }
        System.out.println(sum);
    }
}
